package com.kds.changzhou.handler;

import com.kds.changzhou.message.outboud.AbstractOutBoundMessage;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageEncoder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author 孔德嵩
 */
@Component
@Slf4j
public class XmlEncoder extends MessageToMessageEncoder {


    @Override
    protected void encode(ChannelHandlerContext ctx, Object msg, List out) throws Exception {
        AbstractOutBoundMessage message = (AbstractOutBoundMessage) msg;
        message.loadData();
        out.add(message);
    }
}
